
from django import http
from django.utils import translation
from seblog.web.render import render_to_response

def index(request):
    r = http.HttpResponse('<h1>there are all my demo</h1><ul>')
    r.write('<li><a href="gift/">gift</a></li>')
    r.write('<li><a href="update/">update</a></li>')
    r.write('<li><a href="update_ajax/">update_ajax</a></li>')
    r.write('<li><a href="memcache/">memcache</a></li>')
    r.write('<li><a href="calendar/">my_calendar</a></li>')
    r.write('<li><a href="filebrowser/">file_browser</a></li>')
    r.write('<li><a href="adminindex/">admin_index</a></li>')
    r.write('<li><a href="switchstyle/">switch_style</a></li>')
    r.write('<li><a href="languageIndex/">language_change (age fail)</a></li>')
    r.write('</ul>')
    return r

def switchStyle(request):
    return render_to_response('demoapp/switchstyle/index.html', {}, request)

def language_change_view(request):
    lang_code = request.GET.get('language_code', 'zh_cn')
    translation.activate(lang_code)
    return render_to_response('demoapp/common/language_change.html', {'language_code':lang_code}, request)

    